package com.lanchetech.dao;

import com.lanchetech.bean.request.SubscribeRecordPageReq;
import com.lanchetech.bean.vo.SubscribeRecordVO;
import com.lanchetech.entity.SubscribeRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface SubscribeRecordMapper {
    int deleteByPrimaryKey(Long id);

    int insert(SubscribeRecord record);

    int insertSelective(SubscribeRecord record);

    SubscribeRecord selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SubscribeRecord record);

    int updateByPrimaryKey(SubscribeRecord record);

    List<SubscribeRecordVO> findAllPage(SubscribeRecordPageReq req);

    SubscribeRecord findOneByUserIdAndRelateId(@Param("userId") Long userId, @Param("relateId") Long relateId);

    List<SubscribeRecord> findAllByActivityId(@Param("activityId") Long activityId);

    Long countByActivityId(@Param("activityId") Long activityId);

    SubscribeRecord findOneByUserIdAndRelateIdAndType(@Param("userId")Long userId,@Param("relateId")Long relateId,@Param("type")Byte type);

    List<Long> findRelateIdByUserIdAndTypeAndActivityId(@Param("userId")Long userId,@Param("type")Byte type,@Param("activityId")Long activityId);

    SubscribeRecord findOneByActivityIdAndUserId(@Param("activityId")Long activityId,@Param("userId")Long userId);
}